package com.example.h1nson.realphotography.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.h1nson.realphotography.R;

import java.util.List;
import java.util.Map;

/**
 * Created by H1nson on 2016/5/23.
 */
public class FindAdapter1 extends BaseAdapter {
    private LayoutInflater inflater;
    private List list;
    public FindAdapter1(LayoutInflater inflater,List<Map> list){
        this.list = list;
        this.inflater = inflater;
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView==null) {
            convertView = inflater.inflate(R.layout.listview_find_item1, null);
        }
            TextView textView1 = (TextView) convertView.findViewById(R.id.list_item_name1);
            TextView textView2 = (TextView) convertView.findViewById(R.id.list_item_word1);
            TextView textView3 = (TextView) convertView.findViewById(R.id.list_item_time1);
            Map map = (Map)list.get(position);
            System.out.println(position);
            textView1.setText(map.get("commenterName").toString());
            textView2.setText(map.get("commentContent").toString());
            textView3.setText(map.get("commentDate").toString());
        System.out.println("加载评论"+position+"  "+list.size());

        return convertView;
    }
}
